import java.util.List;

public class JourneyCharacterIterator implements IJourneyIterator{
    private List<JourneyCharacter> characters;
    private int position;

    public JourneyCharacterIterator(List<JourneyCharacter> characters) {
        this.characters = characters;
        this.position = 0;
    }

    @Override
    public boolean hasNext() {
        return position < characters.size();
    }

    @Override
    public JourneyCharacter next() {
        if (!hasNext()) {
            throw new IndexOutOfBoundsException("No more characters to iterate.");
        }
        JourneyCharacter character = characters.get(position);
        position++;
        return character;
    }
}
